{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=1
  Verdict: Accepted
}
uses SysUtils, Math;
 
var
	i,n,c,count,cur,l,r,m,ans:longint;
	a:array[1..100010] of longint;
 
procedure sort(l,r:longint);
var
	i,j,x,y:longint;
begin
i:=l;
j:=r;
x:=a[(l+r) div 2];
repeat
	while a[i]<x do inc(i);
	while a[j]>x do dec(j);
	if i<=j then begin
		y:=a[i];
		a[i]:=a[j];
		a[j]:=y;
		inc(i);
		dec(j);
	end;
until i>j;
if l<j then sort(l,j);
if i<r then sort(i,r);
end;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
read(n,c);
ans:=maxlongint;
for i:=1 to n do 
	read(a[i]);
sort(1,n);
l:=0;
r:=a[n];
while l<r do begin
	m:=(l+r+1) div 2;
	count:=1;
	cur:=a[1];
	for i:=2 to n do
		if a[i]-cur<m then continue else begin
			cur:=a[i];
			inc(count);
		end;
	if count>=c then begin
		l:=m;
		ans:=m;
	end else r:=m-1;
end;
write(ans);
end.